package com.net.wanjian.networkhospitalmanager.activity.evaluate;

import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.net.wanjian.networkhospitalmanager.R;
import com.net.wanjian.networkhospitalmanager.activity.base.BaseActivity;
import com.net.wanjian.networkhospitalmanager.adapter.base.BaseViewPagerAdapter;
import com.net.wanjian.networkhospitalmanager.bean.SearchEvaluateResult;
import com.net.wanjian.networkhospitalmanager.fragment.evaluate.SimpleEvaluateFragment;
import com.net.wanjian.networkhospitalmanager.netstatus.NetUtils;

import butterknife.BindView;
import butterknife.ButterKnife;

public class SimpleEvaluateActivity extends BaseActivity {
public static final String SIMPLE_EVALUATE_ACTIVITY_EVENT_ID = "simple_evaluate_activity_event_id";

    @BindView(R.id.top_back_layout)
    LinearLayout topBackLayout;
    @BindView(R.id.top_title_tv)
    TextView topTitleTv;
    @BindView(R.id.simple_evaluate_tablayout)
    TabLayout simpleEvaluateTablayout;
    @BindView(R.id.simple_evaluate_viewpager)
    ViewPager simpleEvaluateViewpager;

    private Fragment[] mFragments;
    private String[] mTitles;

//    private DepthEvaluateFragment depthEvaluateFragmentl;
    private SimpleEvaluateFragment simpleEvaluateFragment;

    @Override
    protected void initData() {

        topTitleTv.setText("评价");
        topBackLayout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                SimpleEvaluateActivity.this.finish();
            }
        });

        SearchEvaluateResult.DataBean.EventListBean simpleEvent = (SearchEvaluateResult.DataBean.EventListBean) getIntent().getExtras().getSerializable(SIMPLE_EVALUATE_ACTIVITY_EVENT_ID);

//        depthEvaluateFragmentl = DepthEvaluateFragment.getInstance();
        simpleEvaluateFragment = SimpleEvaluateFragment.getInstance(simpleEvent);

        mTitles = new String[]{"简易评价"};
        mFragments = new Fragment[]{simpleEvaluateFragment};

        BaseViewPagerAdapter viewPagerAdapter = new BaseViewPagerAdapter(getSupportFragmentManager(), mFragments, mTitles);
        simpleEvaluateViewpager.setOffscreenPageLimit(1);
        simpleEvaluateViewpager.setAdapter(viewPagerAdapter);
        simpleEvaluateTablayout.setupWithViewPager(simpleEvaluateViewpager);
        simpleEvaluateTablayout.setVisibility(View.GONE);

    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_simple_evaluate;
    }

    @Override
    protected void onNetworkConnected(NetUtils.NetType type) {

    }

    @Override
    protected void onNetworkDisConnected() {

    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);
    }
}
